import { BasicColumn } from '/@/components/Table/src/types/table';
import { FormSchema } from '/@/components/Form';

import { useI18n } from '/@/hooks/web/useI18n';

const { t } = useI18n();

// 选择流程模板表格
export function getProcessColumn(): BasicColumn[] {
  return [
    {
      title: t('routes.table.processTemplate.code'),
      dataIndex: 'id',
      fixed: 'left',
      width: 150,
    },
    {
      title: t('routes.table.processTemplate.name'),
      dataIndex: 'name',
      width: 150,
    },
    {
      title: t('routes.table.processTemplate.status'),
      dataIndex: 'status',
      width: 120,
    },
    {
      title: t('routes.table.processTemplate.createTime'),
      dataIndex: 'createTime',
      width: 150,
      slots: { customRender: 'createTime' },
    },
    {
      title: t('routes.table.processTemplate.objectType'),
      dataIndex: 'classApplicable',
      width: 200,
    },
    {
      title: t('routes.table.processTemplate.createPerson'),
      dataIndex: 'creator',
      width: 120,
    },
    {
      title: t('routes.table.processTemplate.remark'),
      dataIndex: 'remark',
      width: 120,
    },
    {
      title: t('routes.table.processTemplate.principal'),
      dataIndex: 'actor',
      width: 120,
    },
    {
      title: t('routes.table.processTemplate.overdueTimeSetting'),
      dataIndex: 'overTimeProcess',
      width: 160,
    },
    {
      title: t('routes.table.processTemplate.overTime'),
      dataIndex: 'estCostTime',
      width: 120,
    },
    {
      title: t('routes.table.processTemplate.securityLevel'),
      dataIndex: 'securityLevel',
      width: 120,
    },
  ];
}

export function getUserModalColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.components.userModal.loginName'),
      dataIndex: 'id',
      width: 200,
    },
    {
      title: t('routes.components.userModal.username'),
      dataIndex: 'name',
      width: 200,
    },
  ];
}

export function getFrameColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.partManager.productStructurePage.FramePage.code'),
      dataIndex: 'id',
      fixed: 'left',
      width: 200,
    },
    {
      title: t('routes.demo.partManager.productStructurePage.FramePage.material'),
      dataIndex: 'material',
      width: 150,
    },
    {
      title: t('routes.demo.partManager.productStructurePage.FramePage.quantity'),
      dataIndex: 'quantity',
      width: 150,
    },
    {
      title: t('routes.demo.partManager.productStructurePage.FramePage.remark'),
      dataIndex: 'remark',
      width: 150,
    },
    {
      title: t('routes.demo.partManager.productStructurePage.FramePage.partName'),
      dataIndex: 'partName',
      width: 150,
    },
    {
      title: t('routes.demo.partManager.productStructurePage.FramePage.weight'),
      dataIndex: 'weight',
      width: 150,
    },
    {
      title: t('routes.demo.partManager.productStructurePage.FramePage.totalWeight'),
      dataIndex: 'totalWeight',
      width: 150,
    },
  ];
}

export function getAttributeColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.partManager.productStructurePage.FramePage.attributeName'),
      dataIndex: 'attributeName',
      fixed: 'left',
      width: 200,
    },
    {
      title: t('routes.demo.partManager.productStructurePage.FramePage.attributeValue'),
      dataIndex: 'attributeValue',
      width: 150,
    },
  ];
}

export function getFrameForm(): FormSchema[] {
  return [
    {
      field: 'paperType',
      component: 'ApiSelect',
      label: t('routes.demo.partManager.productStructurePage.FramePage.paperType'),
      componentProps: {
        placeholder: t('routes.demo.partManager.productStructurePage.FramePage.selectPaperType'),
      },
    },
    {
      field: 'drawingSize',
      component: 'ApiSelect',
      label: t('routes.demo.partManager.productStructurePage.FramePage.drawingSize'),
      componentProps: {
        placeholder: t('routes.demo.partManager.productStructurePage.FramePage.selectDrawingSize'),
      },
    },
  ];
}

export function getAddChildForm(): FormSchema[] {
  return [
    {
      field: 'code',
      component: 'Input',
      label: t('routes.demo.partManager.productStructurePage.addChildPage.code'),
      slot: 'code',
    },
    {
      field: 'quantity',
      component: 'Input',
      label: t('routes.demo.partManager.productStructurePage.addChildPage.quantity'),
      componentProps: {
        placeholder: t(
          'routes.demo.partManager.productStructurePage.addChildPage.quantityPlaceholder',
        ),
      },
    },
    {
      field: 'remark',
      component: 'Input',
      label: t('routes.demo.partManager.productStructurePage.addChildPage.remark'),
      componentProps: {
        placeholder: t(
          'routes.demo.partManager.productStructurePage.addChildPage.remarkPlaceholder',
        ),
      },
    },
    {
      field: 'base',
      component: 'Input',
      label: t('routes.demo.partManager.productStructurePage.addChildPage.base'),
      componentProps: {
        placeholder: t('routes.demo.partManager.productStructurePage.addChildPage.basePlaceholder'),
      },
    },
    {
      field: 'lossRate',
      component: 'Input',
      label: t('routes.demo.partManager.productStructurePage.addChildPage.lossRate'),
      componentProps: {
        placeholder: t(
          'routes.demo.partManager.productStructurePage.addChildPage.lossRatePlaceholder',
        ),
      },
    },
  ];
}

export function getExactColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.partManager.productStructurePage.FramePage.attributeName'),
      dataIndex: 'name',
      fixed: 'left',
      width: 200,
    },
    {
      title: t('routes.demo.partManager.productStructurePage.FramePage.attributeValue'),
      dataIndex: 'value',
      width: 150,
      slots: { customRender: 'value' },
    },
  ];
}

/**
 * 模块名:流程实例信息
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2025/01/03 13:25:26
 */
export function getDocProcessForm(): FormSchema[] {
  return [
    {
      field: 'wfinsid',
      component: 'Input',
      label: t('routes.demo.workFlow.flowExamplePage.code'),
      colProps: {
        xl: 12,
        xxl: 8,
      },
      componentProps: {
        readonly: true,
      },
    },
    {
      field: 'wfinsname',
      component: 'Input',
      label: t('routes.demo.workFlow.flowExamplePage.name'),
      colProps: {
        xl: 12,
        xxl: 8,
      },
      componentProps: {
        readonly: true,
      },
    },
    {
      field: 'wfinstate',
      component: 'Input',
      label: t('routes.demo.workFlow.flowExamplePage.status'),
      colProps: {
        xl: 12,
        xxl: 8,
      },
      componentProps: {
        readonly: true,
      },
    },
    {
      field: 'wfinscreatorname',
      component: 'Input',
      label: t('routes.demo.workFlow.flowExamplePage.creator'),
      colProps: {
        xl: 12,
        xxl: 8,
      },
      componentProps: {
        readonly: true,
      },
    },
    {
      field: 'wfinscreatetime',
      component: 'Input',
      label: t('routes.demo.workFlow.flowExamplePage.createTime'),
      colProps: {
        xl: 12,
        xxl: 8,
      },
      componentProps: {
        readonly: true,
      },
    },
  ];
}

/**
 * 模块名:步骤列表
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2025/01/03 15:54:52
 */
export function getFlowDetailColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.table.ProcessInstanceList.processStep'),
      dataIndex: 'stepname',
      fixed: 'left',
      width: 300,
    },
    {
      title: t('routes.table.ProcessInstanceList.stepStatus'),
      dataIndex: 'stepstate',
      width: 200,
    },
    {
      title: t('routes.table.ProcessInstanceList.textAnnotation'),
      dataIndex: 'steppz',
      width: 200,
    },
    {
      title: t('routes.table.ProcessInstanceList.assessment'),
      dataIndex: 'projscore',
      width: 200,
    },
    {
      title: t('routes.table.ProcessInstanceList.stepResponsiblePerson'),
      dataIndex: 'stepactor',
      width: 200,
    },
    {
      title: t('routes.table.ProcessInstanceList.actualSigner'),
      dataIndex: 'stepsign',
      width: 200,
    },
    {
      title: t('routes.table.ProcessInstanceList.signTime'),
      dataIndex: 'stepsigntime',
      width: 200,
    },
    {
      title: t('routes.table.ProcessInstanceList.remark'),
      dataIndex: 'stepnotes',
      width: 200,
    },
  ];
}
